package com.yy.wga.goods.feign.api;

import com.yy.wga.common.core.dto.PageBean;
import com.yy.wga.common.core.dto.Result;
import com.yy.wga.goods.feign.request.GetCategoryGoodsReq;
import com.yy.wga.goods.feign.request.GetSpuListReq;
import com.yy.wga.goods.feign.request.GoodsTransferReq;
import com.yy.wga.goods.feign.response.GetResourceGoodsCategoryResponse;
import com.yy.wga.goods.feign.response.GoodSpuListResp;
import com.yy.wga.goods.feign.response.GoodsInfoResp;
import com.yy.wga.goods.feign.response.GoodsProductPromotionLinkResp;
import com.yy.wga.goods.feign.response.GoodsShareResp;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;

/**
 * 商品管理
 *
 * @author guochao
 * @since 2024-10-25 21:46:26
 */
@FeignClient(name = "BusinessCourseFeign", url = "https://wga-api.xianrcj.com",
        path = "/api/goods")
public interface GoodsFeign {

    /**
     * 获取分类列表
     *
     * @return
     */
    @GetMapping("getCategoryMap")
    Result<Map<String, Integer>> getCategoryMap();

    /**
     * 商品列表
     *
     * @return
     */
    @PostMapping("list")
    Result<GoodSpuListResp> list(@RequestBody @Valid GetSpuListReq request);

    // TODO 增加合作商品分类
    // TODO 增加合作商品商品详情

    /**
     * 分享商品
     * @param request
     * @return
     */
    @PostMapping("share")
    Result<GoodsShareResp> share(@RequestBody @Valid GoodsTransferReq request);

    /**
     * 获取品类
     * @return
     */
    @GetMapping(value = "getCategory")
    Result<List<GetResourceGoodsCategoryResponse>> listCategory();

    /**
     * 获取品类下的推客商品
     * @param request
     * @return
     */
    @PostMapping("getCategoryGoods")
    Result<PageBean<GoodsInfoResp>> getCategoryGoods(@RequestBody @Valid GetCategoryGoodsReq request);

    /**
     * 商品转链
     * @param request
     * @return
     */
    @PostMapping("getProductPromotionLink")
    Result<GoodsProductPromotionLinkResp> getProductPromotionLink(@RequestBody @Valid GoodsTransferReq request);
}
